var { wechatAdminLogin } = require('../../utils/api');
const methods = require('../../utils/methods');
const app = getApp();

Page({
 data: {
   account: '',
   password: ''
 },
 accountInput(e) {
   this.setData({
    account: e.detail.value
   })
 },
 passwordInput(e) {
   this.setData({
     password: e.detail.value
   })
 },
 onLogin() {
   let _this = this;
   let userid = '';
   console.log(this.data.phone+'----------'+this.data.password+'-------'+app.globalData.openid)
   wechatAdminLogin({"roles": 3,"openid": app.globalData.openid,"account":this.data.account,"password":this.data.password}).then((result) => {
    console.log('result==', result.data)
    if(result.data.code == 200){
      app.globalData.id = result.data.id;
      wx.redirectTo({
          url: '/pages/managehome/index'
      })
    }else{
      console.log(result.data.message)
      methods.showToast(result.data.message)
    }
   });
 }
})